chore(clerk-js,shared): Add API methods to manage enterprise connections#8421
chore(clerk-js,shared): Add API methods to manage enterprise connections#8421LauraBeatris wants to merge 9 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: ce26d30 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
060d051 to
9901d81
Compare
9901d81 to
4980744
Compare
4980744 to
6370206
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds APIs, types, and tests for managing "me" enterprise connections and their test runs. Introduces an EnterpriseConnectionTestRun resource with JSON ↔ resource mapping and snapshot serialization. Extends the User resource with create/update/delete enterprise connection endpoints and create/list test-run endpoints (with pagination and status filtering). Adds shared TypeScript types and re-exports, updates a React hook to expose CRUD callbacks and revalidate, and adds a changeset for minor releases. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
8423e36 to
ec3adb3
Compare
ec3adb3 to
ad95b50
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx (1)
52-75:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse
invalidationKeywhen revalidating.
stableKeyis only the prefix, so this invalidates every enterprise-connection cache entry instead of the current user/settings scope. The cache-key helper already exposesinvalidationKeyfor this path, so use that here.Suggested fix
- const { queryKey, stableKey, authenticated } = useUserEnterpriseConnectionsCacheKeys({ + const { queryKey, invalidationKey, stableKey, authenticated } = useUserEnterpriseConnectionsCacheKeys({ userId: user?.id ?? null, withOrganizationAccountLinking, }); @@ - () => queryClient.invalidateQueries({ queryKey: [stableKey] }), - [queryClient, stableKey], + () => queryClient.invalidateQueries({ queryKey: invalidationKey }), + [queryClient, invalidationKey],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx` around lines 52 - 75, The revalidate callback currently invalidates using the broader stableKey which clears all enterprise-connection entries; update the callback in useUserEnterpriseConnections.tsx to use the more specific invalidationKey from useUserEnterpriseConnectionsCacheKeys (replace stableKey with invalidationKey in the invalidateQueries call inside the revalidate function) so that queryClient.invalidateQueries targets the current user/settings scope instead of every enterprise-connection entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/shared/src/react/hooks/useUserEnterpriseConnections.tsx`:
- Around line 52-75: The revalidate callback currently invalidates using the
broader stableKey which clears all enterprise-connection entries; update the
callback in useUserEnterpriseConnections.tsx to use the more specific
invalidationKey from useUserEnterpriseConnectionsCacheKeys (replace stableKey
with invalidationKey in the invalidateQueries call inside the revalidate
function) so that queryClient.invalidateQueries targets the current
user/settings scope instead of every enterprise-connection entry.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: fe4ba92f-d3af-490b-9d0c-3ee807fac29a
📒 Files selected for processing (10)
.changeset/pink-dolls-rush.mdpackages/clerk-js/src/core/resources/EnterpriseConnectionTestRun.tspackages/clerk-js/src/core/resources/User.tspackages/clerk-js/src/core/resources/__tests__/User.test.tspackages/clerk-js/src/core/resources/internal.tspackages/shared/src/react/hooks/useUserEnterpriseConnections.tsxpackages/shared/src/types/enterpriseConnection.tspackages/shared/src/types/enterpriseConnectionTestRun.tspackages/shared/src/types/index.tspackages/shared/src/types/user.ts
✅ Files skipped from review due to trivial changes (4)
- packages/clerk-js/src/core/resources/internal.ts
- .changeset/pink-dolls-rush.md
- packages/shared/src/types/index.ts
- packages/shared/src/types/enterpriseConnection.ts
cdf5ffa to
d9ebc11
Compare
Description
This PR introduces the existing FAPI API methods to manage enterprise connections + create test runs, those will be used in the
<ConfigureSSO />componentWe won't create specific public React hooks for those yet, in order to see how it'll be used on our implementation first, and then design a better interface for it later.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change